<?php
// Check to ensure this file is included in Joomla!
defined( '_JEXEC' ) or die( 'Restricted access' );

jimport('joomla.application.component.model');

class LettermanModelNewsletters extends JModel
{

	var $_data = null;

	function __construct()
	{
		parent::__construct();

	}

	function getData()
	{
		if (empty($this->_data))
		{
			$query = $this->_buildQuery();
			$this->_data = $this->_getList($query);
		}

		return $this->_data;
	}
	
	function _buildQuery()
	{		
		$sql = "SELECT c.id, " .
			"c.title, " .
			"c.alias, " .
			"c.description, " .
			"c.image " .
			"FROM #__letterman_campaigns AS c " .
			"WHERE c.published = 1 " .
			"ORDER BY c.title";	
		return $sql;

	}

}